Crate tzdb

source ·
Expand description

tzdb — Time Zone Database

tzdb v0.2.14 and higher re-export tzdb v0.5

GitHub Workflow Status Crates.io Minimum supported Rust version License

Static time zone information for tz-rs.

This crate provides all time zones found in the Time Zone Database.

Usage examples

use tz::{DateTime, TimeZone};
use tzdb::{time_zone, tz_by_name};

// access by identifier
DateTime::now(time_zone::europe::KYIV);
// access by name
DateTime::now(tz_by_name("Europe/Berlin").unwrap());
// names are case insensitive
DateTime::now(tz_by_name("ArCtIc/LongYeArByEn").unwrap());

Feature flags

  • serde-as — alias for serde-as-1
  • serde-as-1 — enables the module serde_as to (de)serialize (Utc)DateTimes with serde and serde_with (v1)
  • serde-as-2 — enables the module serde_as to (de)serialize (Utc)DateTimes with serde and serde_with (v2)

Modules

Changes between the versions
serde_asserde-as-1 or serde-as-2
Helper functions to be used with serde and serde_with
serde_as_1serde-as
Helper functions to be used with serde and serde_with (v1.x.y)
serde_as_2serde-as-2
Helper functions to be used with serde and serde_with (v2.x.y)
All defined time zones statically accessible

Constants

A list of all known time zones
The version of the source Time Zone Database
The SHA512 hash of the source Time Zone Database (using the “Complete Distribution”)

Functions

Find the time zone of the current system
Find the raw, unparsed time zone data by name, e.g. "Europe/Berlin" (case-insensitive)
Find a time zone by name, e.g. "Europe/Berlin" (case-insensitive)